{extend name="./oscshop/admin/view/public/base.html" /}
{block name="content"}
<div class="page-header">
	<h1>	
		{$breadcrumb1}
		<small>
			<i class="ace-icon fa fa-angle-double-right"></i>
			{$breadcrumb2}
		</small>
	</h1>
</div>

<form>	
<table class="table table-striped table-bordered table-hover search-form">
	<thead>
		<tr>
			<th style="width: 30%">

				从<input name="begin_time" type="date" placeholder="开始时间" value="{:input('param.begin_time')}" />
				至<input name="end_time" type="date" placeholder="结束时间" value="{:input('param.end_time')}" />之前
			</th>
			<th>
				<a class="btn btn-primary" href="javascript:;" id="search" url="{:url('fin/integral')}">查询</a>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<a class="btn btn-primary" href="javascript:;" id="immediate">即时查询</a>
			</th>
		</tr>



	</thead>
</table>	
<div class="row">
	<div class="col-xs-12">	
		<div class="table-responsive">
			<table class="table table-striped table-bordered table-hover">
				<thead>
					<tr>											
						<th>宝豆</th>
						<th>吉豆</th>
						<th>元宝</th>
						<th>时间</th>
					</tr>
				</thead>
				<tbody>
						{volist name="list" id="v"}
						<tr>						
							<td>{$v.bao}</td>
							<td>{$v.jilt}</td>
							<td>{$v.jilin_bean}</td>
							<td>{$v.dt}</td>
						</tr>
						{/volist}	
						
						<tr>
							<td colspan="50" class="page">{$list->render()}</td>
						</tr>
				</tbody>
				
			</table>
		</div>
	</div>
</div>
</form>
{/block}
{block name="javascript"}
<script>
	$(function(){
		$("#search").click(function () {
			var url = $(this).attr('url');
			var query = $('.search-form').find('input,select').serialize();
			query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
			query = query.replace(/^&/g, '');
			if (url.indexOf('?') > 0) {
				url += '&' + query;
			} else {
				url += '?' + query;
			}
			window.location.href = url;
		});

		$("#current").click(function () {
			var url = $(this).attr('url');
			var query = $('.search-form').find('input,select').serialize();
			query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
			query = query.replace(/^&/g, '');
			if (url.indexOf('?') > 0) {
				url += '&' + query;
			} else {
				url += '?' + query;
			}
			window.location.href = url;
		});
	});

	$('#immediate').click(function(){
		$.ajax({
			url : "{:url('fin/immediate')}",
			type : 'post',
			data : {token:'4564112sda'},
			success : function(d){
				if(d.error){
					alert(d.error);
				}else if(d.success){
					var tips = '宝豆：'+d.data.bao+'，吉豆：'+d.data.jilt+'，元宝：'+d.data.jilin_bean+'，奖励票：'+d.data.ticket+'，金豆B：'+d.data.predeposit+'，金豆A：'+d.data.b2_predeposit;
					alert(tips);
				}
			}
		})
	});

</script>
{/block}